shortcutcontroller: Don't reinject menu accels
authorMatthias Clasen <mclasen@redhat.com>
Thu, 17 Jun 2021 12:43:48 +0000 (08:43 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 17 Jun 2021 12:50:26 +0000 (08:50 -0400)
commit7344a03aa33e334e034a6542b391f9649ffe38f5
treeffc4f72c91dcae163151b7ff163db53b42ec4521
parent64af90111e21364b54f7f430a557a912fa887270
shortcutcontroller: Don't reinject menu accels

The normal way to associate accels with actions is
to attach a shortcut controller to the widget. The shorcut
controller will inject the accel into the action muxer
tree, so that it can get displayed in widgets that activate
the action (say, in menus.

This approach does not works for generated menus, since the
widgets are not in the hands of the app developer, so attaching
shortcut controllers to them is impractical.

Instead, GtkModelButton has an accel property that gets
bound to the accel coming from the action muxer tree (most
likely put there via gtk_application_set_accel_for_action),
and creates a shortcut controller itself.

The change in this commit is to prevent the shortcut controller
from injecting the accel into the action muxer tree in this case.
Otherwise, the accels get 'stuck' and we won't update them if the
global accels are later changed.

This is a hack, and needs a better solution.
gtk/gtkshortcutcontroller.c